// Copyright 2012, Jun Chen .All rights reserved.
//
// Use of this source code is governed by a BSD-Style license that can be
// found in the License fule.
//
// Author: cpp.cheen at gmail dot com.


#ifndef EVT_THREAD_H
#define EVT_THREAD_H
#include   "pch_files.h"
#include    <boost/thread.hpp>
#include    <boost/thread/condition.hpp>
#include    <boost/function.hpp>
#include    <boost/smart_ptr.hpp>

class evt_dispather;
class thread_warper;


class evt_thread
{
    typedef boost::shared_ptr<thread_warper>    thread_ptr;
    public:
        /** Default constructor */
        evt_thread();
        /** Default destructor */
        virtual ~evt_thread();

        evt_dispather*        start();
        void        join();

    protected:
        void            thread_func();
    private:
        evt_dispather*  m_dispather_ptr;
        boost::mutex    m_mutex;
        boost::mutex    m_cond_mutex;
        boost::condition   m_cond;
        thread_ptr          m_thread;
};

#endif // EVT_THREAD_H
